﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Matrix.Common.Utility.StringTools
{
    public class BillNumberBuilder
    {
        private static object locker = new object();
        private static int sn = 0;
        public static string NextBillNumber(string preFix)
        {
            lock (locker)
            {
                if (sn == 999999999)
                    sn = 0;
                else
                    sn++;
                return preFix + DateTime.Now.ToString("MMddHHmm") + sn.ToString().PadLeft(9, '0');
            }
        }
        // 防止创建类的实例
        private BillNumberBuilder() { }
    }
}
